package cn.ad.enumration;


/**
 * 自由平台广告形式与AdView平台广告形式的Mapping
 * Created by Administrator on 2016/7/26.
 */
public enum AdviewFormat {

    ADFORMAT_BANNER("1", 0), //横幅
    ADFORMAT_INTERSTITINAL("2", 1),  //插屏
    ADFORMAT_SPREAD("3", 4);  //开屏

    private String name;
    private int value;

    private static java.util.HashMap<String,Integer> mappings;

    private synchronized static java.util.HashMap<String, Integer> getMappings() {
        if (mappings == null) {
            mappings = new java.util.HashMap<String, Integer>();
            for (AdviewFormat format : AdviewFormat.values()) {
                mappings.put(format.name, format.value);
            }
        }
        return mappings;
    }

    AdviewFormat(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public static String forValue(String name){
        return getMappings().get(name).toString();
    }
}
